package com.abstr;

/**
 * 公共的一个工厂
 */
public class FruitAbsFactoryImpl implements FruitAbsFactory {

    @Override
    public FruitAbs selectType(String fruitNum) {
        char ch = fruitNum.charAt(0);
        FruitAbsFactory fruitAbsFactory = null;
        if(ch == '1'){
            fruitAbsFactory = new FruitTypeOneFactory();
        }else if (ch == '2'){
            fruitAbsFactory = new FruitTypeTwoFactory();
        }else if(ch == '3'){
            fruitAbsFactory = new FruitTypeThreeFactory();
        }

        if(fruitAbsFactory != null){
            return fruitAbsFactory.selectType("123");
        }
        return null;
    }
}
